{% extends "layouts/application.html" %}
{% block content %}

<script type="text/javascript">
function pageselectCallback(page_id, jq){
	//alert(page_id)
	window.location.href="?page="+(page_id+1);
}
$(document).ready(function(){
	// Create pagination element
    $("#Pagination").pagination({{objects.paginator.count}}, {
		num_edge_entries: 2,
		num_display_entries: 8,
		current_page:({{objects.number}}-1),
        callback: pageselectCallback
    });
});
function check_select_one(title_id, cbs_name){
    if(document.getElementById(title_id).checked){
        alert("请选择其中的一条记录");
        return false;
    }
    var row_cbs = document.getElementsByName(cbs_name);
    var checked_number = 0;
    var check_id;
    for(var i = 0; i < row_cbs.length; i++){
        if(row_cbs[i].checked){
			check_id = row_cbs[i].value;
            checked_number += 1;
            if(checked_number > 1){
                alert("请选择其中的一条记录");
                return false;
            }
        }
    }
    if(checked_number == 0){
        alert("请选择其中的一条记录");
        return false;
    }
    location.href='/{%site_root%}/manage/edit_file/'+check_id
}
</script>
<div align="center">
  <div class=boxright>
    <div class=bltop2>
      <div align="left">&nbsp;&nbsp;&nbsp;
        <strong>
          &nbsp;&nbsp;&nbsp;当前位置：&nbsp;&nbsp;
          <a href="/{%site_root%}/manage/index/">后台管理</a>&nbsp;&nbsp;
          <img src="/site_media/images/zd_arrow.gif">&nbsp;&nbsp;
          <a href="/{%site_root%}/manage/resource_sel/">资源管理</a>&nbsp;&nbsp;
          <img src="/site_media/images/zd_arrow.gif">&nbsp;&nbsp;
          <a href="/{%site_root%}/manage/show_dictionary/">参数设置</a>
          <img src="/site_media/images/zd_arrow.gif">&nbsp;&nbsp;
          <a href="#">内容整理</a>
        </strong>
      </div>
    </div>
    <div class="rep_left_height">


        <form action="" method="post">
          <TABLE class=tatop7px cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdw width="4%">
                <INPUT id="chkAll" onclick="title_check('chkAll', 'chkID')"  type=checkbox value=checkbox></TD>
                <TD class=rep_li_c width="10%"><STRONG>一级目录</STRONG></TD>
                <TD class=rep_li_c width="10%"><STRONG>二级目录</STRONG></TD>
                <TD class=rep_li_c width="25%"><STRONG>文件名</STRONG></TD>
                <TD class=rep_li_c width="8%"><STRONG>&nbsp;</STRONG></TD>
                <TD class=rep_li_c width="8%"><STRONG>上传人</STRONG></TD>
                <TD class=rep_li_c width="8%"><STRONG>大小</STRONG></TD>
                <TD class=rep_li_c width="15%"><STRONG>创建日期</STRONG></TD>
                <TD class=rep_li_c width="5%"><STRONG>&nbsp;</STRONG></TD>
              </TR>
              {% if objects %}
              {% for file in objects.object_list %}
                <TR id="tr_{{file.id}}" style="TEXT-DECORATION: none" onMouseOver="this.style.backgroundColor='#EFF8FF'" onmouseout="this.style.backgroundColor=''">
                  <TD class=rtdw2>
                  <INPUT onclick="rows_check('chkAll','chkID');" type=checkbox value="{{file.id}}" name="chkID"></TD>
                  <TD class=rep_li_td_bt ALIGN="left" >{{file.cata.parentId}}</TD>
                  <TD class=rep_li_td_bt ALIGN="left" >{{file.cata}}</TD>
                  <TD class=rep_li_td_bt ALIGN="left" >【{{file.prefix_one}}】【{{file.prefix_two}}】【{{file.prefix_three}}】{{file.name}}</TD>
                  <TD>
                     {% if file.filepic%}
                    <a href="{{file.getImgPath}}" class="imagesview" ><img border="0" src="/site_media/images/picture1.png" height="16" width="16" alt="预览"></a>
                    {% endif %}
                  </TD>
                  <TD class=rep_li_td_bt>{{file.user.username}}</TD>
                  <TD class=rep_li_td_bt>{{file.size|filesizeformat}}</TD>
                  <TD class=rep_li_td_bt>{{file.datetime|date:"Y年n月j日h时i分"}}</TD>
                  <TD class=rep_li_td_bt>
                  	  <a href="{{file.getFilePath}}" target="_blank">下载</a>
                  </TD>
                </TR>
             	{% endfor %}
             	{% endif %}
            </TBODY>
          </TABLE>
          <TABLE cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR vAlign=top>
              <TR vAlign=top ALIGN="left">
                <TD>
                  <INPUT name="button" class="button" id="edit"  type="button" value="编辑文件" onclick="return check_select_one('chkAll', 'chkID')">
                  <INPUT name="button" class="button" id="destroy"  type="submit" value="删除文件" onclick="return check_select('chkID')">
                </TD>
                <td><div id="Pagination" class="pagination"></td>
              </TR>
            </TBODY>
          </TABLE>
        </form>
  </div>
</div>
{% endblock %}